<#assign sj=JspTaglibs["/WEB-INF/struts-jquery-tags.tld"]>
<script language='javascript'>

    function ${parameters.successTopics?html}_errorStyle(){
        $('#indicator3').css({ display: "none"});
    	<#--
    		$( '#${parameters.successTopics?html}_error_msg' ).parent().find(".ui-dialog-titlebar").css({ color: "#ff0011", background: "none",border:"none",padding:"0 0 0 8px",margin:"0"});
     	-->
    }
    function cleardefault(){
       $('.input_default').each(function() {
		this.value = "";
	   });
	   }

$.subscribe('${parameters.successTopics?html}', function(event,data) {
    $('input:text ,select,textarea').css({background: "#fff",border:"1px solid #7F9DB9"});
	var focus="";
	$('#${parameters.successTopics?html}_error_msg').dialog('close');
	if($("#${parameters.successTopics?html}").size()>0&&$("#${parameters.successTopics?html}").html().trim()!=""){
		$('#${parameters.successTopics?html}_open_error_msg').click();
		var atFocus=0;
		
		$("#${parameters.successTopics?html} p").css({cursor: "pointer"});
			$("#${parameters.successTopics?html} p").each(function() {
			
				var pid=$(this).attr("id");
				$('#'+$(this).attr("id").substring(12)).css({background: "#fecdcd",border:"1px solid #cd0a0a"});

				if(atFocus==0){
					$('#'+$(this).attr("id").substring(12)).focus();
					atFocus=1;
				}

				$('#'+$(this).attr("id").substring(12)).focus(function(){
					$($("#"+pid)).css({background: "#fe7671",color:"#fff"});
					focus= pid;
		        });

				$('#'+$(this).attr("id").substring(12)).blur(function(){
					$($("#"+pid)).css({background: "none",color:"#cd0a0a"});
				});

				$(this).mouseover(function(){
					$("#error_infos p").css({background: "none"});
					$(this).css({background: "#fe7671",color:"#fff"});
		        });

		        $(this).mouseout(function(){
					$(this).css({background: "none",color:"#cd0a0a"});
				});

		        $(this).click(function(){
		        	$('#'+$(this).attr("id").substring(12)).focus();
				});
			});
	    }
	    else{
	    $('#${parameters.okButtonId?html}').click();
	  }

});
</script>

<@sj.dialog
    	id="${parameters.successTopics?html}_error_msg"
    	autoOpen="false"
    	modal="false"
    	title="以下のエラーが発生しています。"
    	width="460"
    	position="['right','bottom']"
    	cssStyle="padding:8px;margin: 0;"
    >
<div id="${parameters.successTopics?html}">

</div>
    </@sj.dialog>
    <@sj.a
    	openDialog="${parameters.successTopics?html}_error_msg"
    	onclick="${parameters.successTopics?html}_errorStyle();"
    	id="${parameters.successTopics?html}_open_error_msg"
    	cssStyle="display:none;"
    >
    	Open error_infos dialog
    </@sj.a>